<?php
namespace Popshouse\SiteBundle\Entity;

/**
 * @orm:Entity
 */
class Link{
	
	/**
     * @orm:Id
     * @orm:Column(name="linkid",type="integer")
     * @orm:GeneratedValue(strategy="AUTO")
     */
	protected $id;
	
	/**
     * @orm:Column(type="string")
     * @assert:NotBlank()
     */
	protected $title;
	
	/**
     * @orm:Column(type="text")
     * @assert:Url()
     */
	protected $url;
	
	/**
     * @orm:Column(type="text")
     * @assert:NotBlank()
     */
	protected $description;
	
	/**
     * @orm:Column(type="string")
     * @assert:Choice(
     *     choices = { "nl","fr","de","en" }
     * ))
     */
	protected $lang;
	
	/** 
	 * @orm:Column(name="sort",type="integer")
     */
	protected $sort = 0;
	
	/**
	 * @return the $id
	 */
	public function getId() {
		return $this->id;
	}

	/**
	 * @return the $sort
	 */
	public function getSort() {
		return $this->sort;
	}

	/**
	 * @param field_type $sort
	 */
	public function setSort($sort) {
		$this->sort = $sort;
	}
	
	/**
	 * @return the $title
	 */
	public function getTitle() {
		return $this->title;
	}

	/**
	 * @return the $url
	 */
	public function getUrl() {
		return $this->url;
	}

	/**
	 * @return the $description
	 */
	public function getDescription() {
		return $this->description;
	}

	/**
	 * @return the $lang
	 */
	public function getLang() {
		return $this->lang;
	}

	/**
	 * @param field_type $title
	 */
	public function setTitle($title) {
		$this->title = $title;
	}

	/**
	 * @param field_type $url
	 */
	public function setUrl($url) {
		$this->url = $url;
	}

	/**
	 * @param field_type $description
	 */
	public function setDescription($description) {
		$this->description = $description;
	}

	/**
	 * @param field_type $lang
	 */
	public function setLang($lang) {
		$this->lang = $lang;
	}
	
	/**
	 * @orm:PreRemove
	 */
	public function onRemove(){
		@unlink($this->getImagePath());
	}
	
	
	public function getImageUrl(){
		return "images/photo/links/".$this->getId() . ".jpg";
	}

	public function getImagePath(){
		return PUBLIC_PATH."/".$this->getImageUrl();
	}
	
	public function getAfbeelding(){}
	public function setAfbeelding($afbeelding){}

}